Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PR #961/898ade59 backport][stable-4] Unit test cleanup #962

Conversation

patchback[bot]
Copy link

@patchback patchback bot commented Aug 10, 2022

This is a backport of PR #961 as merged into main (898ade5).

SUMMARY

Speaking to mattclay, pytest based unit tests are generally considered preferred over unittest based unit tests. For the sake of having "good" examples in amazon.aws, migrates unittest based tests over to pytest

Additionally:

  • Moves tests about to reflect module_utils
  • Cleans up the boto3/botocore test skipping
  • uses "pytest.raises" rather than try/except blocks
  • Cleans up unused variables
  • Cleans up unused imports
  • fixes s3_object unit test (was trying to import from the old location, redirects don't handle this)
ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME

tests/units

ADDITIONAL INFORMATION

Unit test cleanup

SUMMARY
Speaking to @mattclay, pytest based unit tests are generally considered preferred over unittest based unit tests.  For the sake of having "good" examples in amazon.aws, migrates unittest based tests over to pytest
Additionally:

Moves tests about to reflect module_utils
Cleans up the boto3/botocore test skipping
uses "pytest.raises" rather than try/except blocks
Cleans up unused variables
Cleans up unused imports
fixes s3_object unit test (was trying to import from the old location, redirects don't handle this)

ISSUE TYPE

Feature Pull Request

COMPONENT NAME
tests/units
ADDITIONAL INFORMATION

Reviewed-by: Alina Buzachis <None>
(cherry picked from commit 898ade5)
@patchback patchback bot mentioned this pull request Aug 10, 2022
@ansibullbot
Copy link

@patchback[bot] This PR contains @ mentions in at least one commit message. Those mentions can cause cascading notifications through GitHub and need to be removed. Please squash or amend your commits to remove the mentions.

click here for bot help

@ansibullbot ansibullbot added feature This issue/PR relates to a feature request module module needs_maintainer needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR needs_triage new_contributor Help guide this first time contributor new_plugin New plugin tests tests labels Aug 10, 2022
@softwarefactory-project-zuul
Copy link
Contributor

Build succeeded.

✔️ ansible-galaxy-importer SUCCESS in 4m 19s
✔️ build-ansible-collection SUCCESS in 4m 51s
✔️ ansible-test-sanity-aws-ansible-python38 SUCCESS in 9m 59s
✔️ ansible-test-sanity-aws-ansible-2.12-python38 SUCCESS in 9m 32s
✔️ ansible-test-sanity-aws-ansible-2.13-python38 SUCCESS in 9m 59s
✔️ ansible-test-units-amazon-aws-python38 SUCCESS in 5m 58s
✔️ ansible-test-units-amazon-aws-python39 SUCCESS in 6m 13s

@tremble tremble added the mergeit Merge the PR (SoftwareFactory) label Aug 10, 2022
@softwarefactory-project-zuul
Copy link
Contributor

Build succeeded (gate pipeline).

✔️ ansible-galaxy-importer SUCCESS in 4m 19s
✔️ build-ansible-collection SUCCESS in 5m 03s
✔️ ansible-test-sanity-aws-ansible-python38 SUCCESS in 9m 33s
✔️ ansible-test-sanity-aws-ansible-2.12-python38 SUCCESS in 9m 35s
✔️ ansible-test-sanity-aws-ansible-2.13-python38 SUCCESS in 9m 24s
✔️ ansible-test-units-amazon-aws-python38 SUCCESS in 6m 18s
✔️ ansible-test-units-amazon-aws-python39 SUCCESS in 6m 27s

@softwarefactory-project-zuul softwarefactory-project-zuul bot merged commit d30bcb5 into stable-4 Aug 10, 2022
@softwarefactory-project-zuul softwarefactory-project-zuul bot deleted the patchback/backports/stable-4/898ade59bfa6ca5692303f8bc20eefde0734ba94/pr-961 branch August 10, 2022 15:00
abikouo pushed a commit to abikouo/amazon.aws that referenced this pull request Oct 24, 2023
…collections#962)

wafv2_web_acl: prevent exception when element is not a dict

SUMMARY
the geo_match_statement statement paremeter country_codes is a list and will fail the current implementation
  File "/tmp/ansible_community.aws.wafv2_web_acl_payload_8xvwtxvw/ansible_community.aws.wafv2_web_acl_payload.zip/ansible_collections/community/aws/plugins/module_utils/wafv2.py", line 52, in wafv2_snake_dict_to_camel_dict
AttributeError: 'str' object has no attribute 'keys'

rules:
    - name: block-germany
      priority: 0
      action:
        block: {}
      visibility_config:
        sampled_requests_enabled: yes
        cloud_watch_metrics_enabled: yes
        metric_name: block-germany
      statement:
        geo_match_statement:
          country_codes:
             - DE
ISSUE TYPE


Bugfix Pull Request

COMPONENT NAME
plugins/module_utils/wafv2.py
ADDITIONAL INFORMATION

Reviewed-by: Alina Buzachis <None>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature This issue/PR relates to a feature request mergeit Merge the PR (SoftwareFactory) module module needs_maintainer needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR needs_triage new_contributor Help guide this first time contributor new_plugin New plugin tests tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants